package cubelabs.nexus.entity;

import java.util.Date;
import java.util.Set;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * Initial version based on work by Steve Chaloner (steve@objectify.be) for
 * Deadbolt2
 */
@Entity
@Table(name = "users")
public class User extends BaseEntity{
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	private Long id;
	@ManyToMany(mappedBy="students")
	Set<Institute> univSubscriptions;
	@ManyToMany(mappedBy="teachers")
	Set<Institute> teachSubscribtions;
	@OneToMany(mappedBy="user")
	Set<CourseSubcriptions> courseSubscriptions;
	
	public Set<CourseSubcriptions> getCourseSubscriptions() {
		return courseSubscriptions;
	}

	public void setCourseSubscriptions(Set<CourseSubcriptions> courseSubscriptions) {
		this.courseSubscriptions = courseSubscriptions;
	}

	public Set<Institute> getUnivSubscriptions() {
		return univSubscriptions;
	}

	public void setUnivSubscriptions(Set<Institute> univSubscriptions) {
		this.univSubscriptions = univSubscriptions;
	}

	public Set<Institute> getTeachSubscribtions() {
		return teachSubscribtions;
	}

	public void setTeachSubscribtions(Set<Institute> teachSubscribtions) {
		this.teachSubscribtions = teachSubscribtions;
	}

	

	

	public static long getSerialversionuid() {
		return serialVersionUID;
	}

	public String email;

	public String name;

	public Date lastLogin;

	public boolean active;

	public boolean emailValidated;

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Date getLastLogin() {
		return lastLogin;
	}

	public void setLastLogin(Date lastLogin) {
		this.lastLogin = lastLogin;
	}

	public boolean isActive() {
		return active;
	}

	public void setActive(boolean active) {
		this.active = active;
	}

	public boolean isEmailValidated() {
		return emailValidated;
	}

	public void setEmailValidated(boolean emailValidated) {
		this.emailValidated = emailValidated;
	}
	
	
	

}
